       Subroutine getlapsvxx(imax,jmax,kmax,maxradar,c_radar_id,         ! I
     &      n_radars,c_extension_proc,i4timefile_proc,i4_tol,rheight_3d, ! I   
     &      lat,lon,topo,i4_file_closest,                                ! I
     &      nx_r,ny_r,igrid_r,                                           ! I
     &      rlat_radar,rlon_radar,rheight_radar,n_valid_radars,          ! O
     &      grid_ra_ref,maxradarg,                                       ! O
     &      grid_ra_ref_offset,ioffset,joffset,maxradaro,                ! O
     &      l_offset,                                                    ! I
     &      istatus)                                                     ! O

       Integer       imax,jmax,kmax  !same as imax,jmax,kmax in lapsparms.for
       Integer       maxradar
       Integer       maxfiles
       Integer       i,j,k,io,jo,kg
       Integer       lvl_3d(kmax)
       Integer       i4time
       Integer       i4_tol
       Integer       n_radars
       Integer       n_ref_grids
       Integer       istatus
       Integer       istatus_2dref
       Integer       istatus_3dref

       Integer       i4timefile_proc
       Integer       i4_file_closest(n_radars)
       Integer       ioffset(maxradar)
       Integer       joffset(maxradar)

!      Note that only one of maxradarg, maxradaro is non-zero
       Real          grid_ra_ref(imax,jmax,kmax,maxradarg)
       Real          grid_ra_ref_offset(nx_r,ny_r,kmax,maxradaro)
       Real          grid_ra_ref_3d(imax,jmax,kmax)             
       Real          rheight_3d (imax,jmax,kmax)
       Real          lat(imax,jmax)
       Real          lon(imax,jmax)
       Real          topo(imax,jmax)
       Real          rlat_radar(maxradar)
       Real          rlon_radar(maxradar)
       Real          rheight_radar(maxradar)
       Real          r_missing_data

       Real          zcoord_of_level
c
c readlaps stuff
c
       Character ext*31, var_3d(kmax)*3,
     &lvl_coord_3d(kmax)*4,units_3d(kmax)*10,
     &comment_3d(kmax)*125

       Character       c_extension_proc(maxradar)*4
       Character*31    ext_a(maxradar)
       Character*4     c_radar_id(maxradar)
       Character*1     c_again

       Logical l_apply_map
       Logical l_low_fill
       Logical l_high_fill
       Logical l_offset

      call get_r_missing_data(r_missing_data,istatus)
      if(istatus .ne. 1)return

c ========================================================
c Read intermediate radar files. This will return the array only with those
c valid radars within the internal 20min time window of 'read_radar_3dref'.
c
      l_apply_map=.true.
      l_low_fill = .true.
      l_high_fill= .true.

      write(6,*)
      write(6,*)'get_laps_vxx: Reading v-file Reflectivity, ',
     1          '# of potential radars = ',n_radars

!     Number of valid radars - change this index to 'l'?
      kg = 0

!$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(
!$OMP&  ext, i4_ret, grid_ra_ref_3d, n_ref_grids,
!$OMP&  istatus_2dref, istatus_3dref, jstatus,
!$OMP&  io, jo, i, j, k, ri, rj)
      do kcount = 1, n_radars

         ext = trim(c_extension_proc(kcount))

         i4_diff = i4timefile_proc - i4_file_closest(kcount)
!$OMP CRITICAL (critical1)
         kg = kg + 1      ! Used for output arrays
         k = kg
!$OMP END CRITICAL (critical1)
         write(6, *) ' radar #, i4_diff = ', kcount, k, i4_diff

         i4_tol_radar = 0 

         call read_radar_3dref(
     &     i4_file_closest(kcount),               ! I
     &     i4_tol_radar,                          ! I
     &     i4_ret,                                ! O
     &     l_apply_map,                           ! I
     &     r_missing_data,                        ! I
     &     imax,                                  ! I
     &     jmax,                                  ! I
     &     kmax,                                  ! I
     &     ext,                                   ! I
     &     lat,                                   ! I
     &     lon,                                   ! I
     &     topo,                                  ! I
     &     l_low_fill,                            ! I
     &     l_high_fill,                           ! I
     &     rheight_3d,                            ! I
     &     grid_ra_ref_3d,                        ! O
     &     rlat_radar(k),                         ! O
     &     rlon_radar(k),                         ! O
     &     rheight_radar(k),                      ! O
     &     c_radar_id(k),                         ! O
     &     n_ref_grids,                           ! O
     &     istatus_2dref,                         ! O
     &     istatus_3dref)                         ! O

c check laps analysis values
         if (istatus_3dref /= 1 .and. istatus_3dref /= -1) then
           write(6, *) 'ERROR: Unsuccessful reading radar ',
     &       kcount, k, ext       
!$OMP CRITICAL (critical2)
           kg = kg - 1
!$OMP END CRITICAL (critical2)
         else
           write(6, *) 'Successful reading radar ',
     &       kcount, k, ext
           write(6, *) 'radar lat/lon/elev: ',
     &       rlat_radar(k),
     &       rlon_radar(k),
     &       rheight_radar(k)
!           Move radar data to second array via offset
            if (l_offset) then
              if (rlat_radar(k) == r_missing_data .or.
     &            rlon_radar(k) == r_missing_data) then
                write(6, *) ' No valid or single lat/lon for radar ',
     &            k, ' ', trim(c_radar_id(k))
                ioffset(k) = 0
                joffset(k) = 0
              else
                call latlon_to_rlapsgrid(
     &            rlat_radar(k),                ! I
     &            rlon_radar(k),                ! I
     &            lat,                          ! I
     &            lon,                          ! I
     &            imax,                         ! I
     &            jmax,                         ! I
     &            ri,                           ! O
     &            rj,                           ! O
     &            jstatus)                      ! O
                if (jstatus /= 1) then
                    write(6, *)
     &                'computing ri/rj for radar (outside domain)',
     &                k, ' ', trim(c_radar_id(k))
                end if
!               Offset is location of lower left corner of small array in the large array
                ioffset(k) = (nint(ri) - igrid_r) - 1
                joffset(k) = (nint(rj) - igrid_r) - 1
              end if

              write(6,*)' getlapsvxx - offset info '
     &               ,'ri,rj,ioffset(k),joffset(k),igrid_r : '
     &                ,ri,rj,ioffset(k),joffset(k),igrid_r

!$OMP CRITICAL (critical3)
              do jo = 1, ny_r
                j = jo + joffset(k)
                if (j >= 1 .and. j <= jmax) then
                  do io = 1, nx_r
                    i = io + ioffset(k)
                    if (i >= 1 .and. i <= imax)then
                      grid_ra_ref_offset(io,jo,:,k) = 
     &                  grid_ra_ref_3d(i,j,:)
                    end if
                  end do
                end if
              end do
!$OMP END CRITICAL (critical3)
            else ! fill 4D array with 3D array contents
!$OMP CRITICAL (critical4)
              grid_ra_ref(:,:,:,k) = grid_ra_ref_3d(:,:,:)
!$OMP END CRITICAL (critical4)
            end if
         end if
      end do
!$OMP END PARALLEL DO

      n_valid_radars = kg

      return
      end
